﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB.Architecture;

namespace YJKRevitDimensionText.OneKeyPlanDim.LevelDim
{
	public class KeyRoom
	{
		public KeyRoom(List<Room> AllRoom)
		{
			this.m_AllRoom = AllRoom;
		}

		public List<Room> ClassificationRooms(string strRoomName)
		{
			List<Room> list = new List<Room>();
			foreach (string value in strRoomName.Split(new char[]
			{
				'_'
			}))
			{
				List<Room> list2 = new List<Room>();
				foreach (Room room in this.m_AllRoom)
				{
					if (room.Name.Contains(value))
					{
						list2.Add(room);
					}
				}
				list2.Sort(new RoomComparer());
				list.AddRange(list2);
			}
			return list;
		}

		public static List<Room> FilterRoomsByRoomName(List<Room> lstAllRoom, string strRoomName)
		{
			List<Room> list = new List<Room>();
			foreach (string value in strRoomName.Split(new char[]
			{
				'_'
			}))
			{
				foreach (Room room in lstAllRoom)
				{
					if (room.Name.Contains(value))
					{
						list.Add(room);
					}
				}
			}
			return list;
		}

		private List<Room> m_AllRoom = new List<Room>();

		private List<Room> m_LstRoom = new List<Room>();
	}
}
